import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import '../src/assets/reset.css'
Vue.config.productionTip = false

import 'amfe-flexible';
import 'lib-flexible/flexible'

import Vant from './vant/vant'
import 'vant/lib/index.css';
Vue.use(Vant);

//全局路由守卫-⚔
router.beforeEach((to, from, next) => {
  let userInfo = null
  let data = sessionStorage.getItem('userInfo')
  userInfo = (data == null ? false : true)
  if(to.path=='/mine'){
    console.log('进入个人中心')
    if(!userInfo){
      next('/login')
    }
  }
  next()
})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
